package com.hqd.ch03.v49.io;

import com.hqd.ch03.v49.core.env.PropertySource;
import com.hqd.ch03.v49.io.support.EncodedResource;

import java.io.IOException;

public interface PropertySourceFactory {

    /**
     * Create a {@link PropertySource} that wraps the given resource.
     *
     * @param name     the name of the property source
     *                 (can be {@code null} in which case the factory implementation
     *                 will have to generate a name based on the given resource)
     * @param resource the resource (potentially encoded) to wrap
     * @return the new {@link PropertySource} (never {@code null})
     * @throws IOException if resource resolution failed
     */
    PropertySource<?> createPropertySource(String name, EncodedResource resource) throws IOException;

}

